package com.jsu.forum.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.example.model.forum.pojo.PassageComment;
import org.example.model.user.pojo.User;

import java.util.List;

@Mapper
public interface CommentMapper extends BaseMapper<PassageComment> {
    @Select("SELECT * FROM passage_comment WHERE passage_id = #{passage_id} ORDER BY likes_count DESC")
    List<PassageComment> selectByPassageIdOrderByLikesCountDesc(@Param("passage_id") int passage_id);

    @Select("SELECT * FROM passage_comment WHERE passage_id = #{passage_id} ORDER BY publish_time DESC")
    List<PassageComment> selectByPassageIdOrderByTime(@Param("passage_id") int passage_id);
}
